<template>
    <view class="pub_page pub_manage_info">
        <pub-head headerName="manage_info" :headerConfig="headerConfig"></pub-head>
        <div class="page_box page_box_scroll" :class="editId ? 'page_box_' + openType : ''"
            :style="{ 'height': `calc(100vh - ${otherHeight})` }">
            <manageCharge :editId="editId" v-if="openType == 1"></manageCharge>
            <manageWarn :editId="editId" v-if="openType == 2"></manageWarn>
            <manageUser :editId="editId" v-if="openType == 3"></manageUser>
            <manageRegion :editId="editId" v-if="openType == 4"></manageRegion>
            <manageRoom :editId="editId" :areaId="areaId" :areaName="areaName" v-if="openType == 5"></manageRoom>
        </div>
    </view>
</template>

<script>

import manageCharge from './manageComponents/charge.vue'
import manageWarn from './manageComponents/warn.vue'
import manageUser from './manageComponents/user.vue'
import manageRegion from './manageComponents/region.vue'
import manageRoom from './manageComponents/room.vue'
export default {
    components: { manageCharge, manageWarn, manageUser, manageRegion, manageRoom },
    data() {
        return {
            headerConfig: {
                title: '',//标题栏内容
                header_color: '#fff'
            },
            otherHeight: getApp().globalData.otherHeight,
            openType: 0,//1收费方案  2预警方案  3用户管理  4区域管理  5房间管理
            openTypeTitle: ['', '收费方案', '预警方案', '客户', '区域', '房间'],
            editId: "",
            areaId: '',//openType为5时有值
            areaName: '',//openType为5时有值
        };
    },
    onLoad(options) {
        console.log(options);
        this.openType = options.openType || 1;
        this.editId = options.editId || "";
        if (this.openType == 5) {
            this.areaId = options.areaId;
            this.areaName = options.areaName;
        }
        this.headerConfig.title = (this.editId ? '编辑' : '新增') + this.openTypeTitle[this.openType];
        // 支付宝小程序设置状态栏文字颜色
        this.$comFun.setZfbNavigationBar();
    },
    methods: {},
};
</script>

<style lang="scss" scoped>
@import "@/common/css/manage.scss";
</style>
